using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PickReinvoiceMap : EntityTypeConfiguration<SO_PickReinvoice>
    {
        public SO_PickReinvoiceMap()
        {
            // Primary Key
            this.HasKey(t => new { t.VENDOR, t.DATE, t.LOCATION });

            // Properties
            this.Property(t => t.INVOICE_)
                .HasMaxLength(8);

            this.Property(t => t.Default_Vendor_)
                .HasMaxLength(6);

            this.Property(t => t.VENDOR)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.ITEM)
                .HasMaxLength(10);

            this.Property(t => t.LOCATION)
                .IsRequired()
                .HasMaxLength(3);

            // Table & Column Mappings
            this.ToTable("SO_PickReinvoice");
            this.Property(t => t.INVOICE_).HasColumnName("INVOICE#");
            this.Property(t => t.Default_Vendor_).HasColumnName("Default_Vendor#");
            this.Property(t => t.VENDOR).HasColumnName("VENDOR");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.expiry_date).HasColumnName("expiry_date");
            this.Property(t => t.LOCATION).HasColumnName("LOCATION");
        }
    }
}
